package Month07.day31;

import java.io.File;

public class DemoTest3 {
    public static void main(String[] args) {
        File file = new File("D:\\Idea-Project\\basic\\yuankang-edu-info-manager");
        int i = checkAllJava(file);
        System.out.println(i);
    }
    private static int checkAllJava(File file) {
        File[] files = file.listFiles();
        int count=0;
        if (files!=null){
            for (File path : files) {
                if (path.isFile()){
                    if (path.getName().endsWith(".java")){
                        count++;
                    }
                }else {
                    count+=checkAllJava(path);
                }
            }
        }
        return count;
    }
}
